package com.usian.fegin;

import com.usian.commom.pojo.User;
import com.usian.commom.vo.ResultCommonVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 *
 * 改服务调用user的接口
 * @TODO:
 * @Author:baimu
 * @Date:2023 11 23 08 54
 **/

@FeignClient("day01-user")
public interface UserFegin {

    @GetMapping("/user/findAllUser")
    public List<User> findAllUser();

    @GetMapping("/user/findUserById")
    public User findUserById(@RequestParam(value = "id") Long id);

    @GetMapping("/user/findUserByUsernameANdage")
    public List<User> findUserByUsernameANdage(@RequestParam(value = "username") String username,
                                               @RequestParam(value = "age") Integer age);


    @PostMapping("/v1/user/saveUser")
    public ResultCommonVo saveUser(@RequestBody User user);

    @PostMapping("/v1/user/findUserPage")
    public ResultCommonVo findUserPage(@RequestBody User user
            , @RequestParam(value = "pageNum",defaultValue = "1") Integer pageNum
            , @RequestParam(value = "pageSize",defaultValue = "10") Integer pageSize);
}
